﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="listbanner.ascx.cs" Inherits="controls_admin_listbanner" %>
<div id="content">
    	<div class="box corners shadow">
            <div class="box-header">
                <img src="../templates/admin/images/banner.png" /><h2>Banner - quảng cáo</h2>
                <div class="box-header-ctrls">	
                	<a href="javascript:void(null);" title="" class="close"><!-- --></a>
                </div>
            </div>
            <div class="box-content" id="media-2">
                <div class="inbox-sf">
                    <span style="font-size:16px">Danh sách vị trí banner - quảng cáo</span>                   
                    <asp:Button ID="btnThem" runat="server" Text="Thêm" 
                        class="inbox-sf-add-btn tip" title="Thêm vị trí banner - quảng cáo mới" 
                        onclick="btnThem_Click" />
                </div>
                <table id="tablesorter-contact" style="width:100%">
                    <asp:Repeater ID="rptDanhSachViTriBanner" runat="server" 
                        onitemcommand="rptDanhSachViTriBanner_ItemCommand"> 
                        <HeaderTemplate>
                	        <thead class="contacts-head-1"> 
                                <tr> 
                                    <th class="contacts-head-1-select" style="width:2%"><asp:CheckBox ID="CheckSelectAll" runat="server"/></th>
                                    <th class="contacts-head-1-id header" style="width:4%">STT</th>
                                    <th class="contacts-head-1-name header" style="width:50%">Tên vị trí banner - quảng cáo</th>                                    
                                    <th class="contacts-head-1-date header" style="width:20%">Trạng thái</th>
                                    <th class="contacts-head-1-actions" style="width:7%">Thao tác</th>                        
                                </tr> 
                            </thead>
                           <tbody class="contacts-content-1">
                        </HeaderTemplate> 
                        <ItemTemplate>                                                                                
                                <tr> 
                                    <td class="contacts-content-1-select" style="width:2%">
                                        <asp:Literal ID="ltID" Text='<%# Eval("Id") %>' Visible="false" runat="server"></asp:Literal>
                                        <asp:CheckBox ID="CheckSelect" runat="server"/>
                                    </td>
                                    <td class="contacts-content-1-id" style="width:4%"><%= stt++%></td>
                                    <td class="contacts-content-1-name" style="width:50%"><%# Eval("TenViTri")%></td>                                    
                                    <td class="contacts-content-1-date" style="width:20%"><%# (Boolean.Parse(Eval("TrangThai").ToString())==true)?"Hoạt động":"Không hoạt động"%></td>
                                    <td class="contacts-content-1-actions" style="width:7%">
                                        <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addbanner.aspx?location=yes&action=edit&info=" + Eval("Id") %>'>Sửa</asp:HyperLink>
                                        <asp:LinkButton ID="lbXoa" runat="server" onclientclick="return confirm('Không thể phục hồi sau khi xóa! Chắc chắn rằng bạn muốn xóa?');" class="delete-contact gradient-btn" CommandArgument='<%# Eval("Id")%>' CommandName="delete" >Xóa</asp:LinkButton>                                                                                
                                    </td>                        
                                </tr>                                                                                                                                                                                                                                                                                   
                        </ItemTemplate>
                        <FooterTemplate></tbody></FooterTemplate>
                    </asp:Repeater>                                            
                </table>
                <div class="box-bt-bar">
                    <div class="bulk-actions">                        
                        <asp:Button ID="btnXoa" class="tip" ToolTip="Xóa vị trí banner đã chọn" 
                            runat="server" Text="Xóa" onclick="btnXoa_Click"/>
                        <asp:Button ID="btnLamMoi" runat="server" Text="Làm mới" class="tip" 
                            ToolTip="Tải lại danh sách" onclick="btnLamMoi_Click" />                        
                    </div>
                </div>
                <br /><br />
                <div class="inbox-sf">
                    <span style="font-size:16px">Danh sách banner - quảng cáo</span>                   
                    <asp:Button ID="btnThemBanner" runat="server" Text="Thêm" 
                        class="inbox-sf-add-btn tip" title="Thêm banner - quảng cáo mới" 
                        onclick="btnThemBanner_Click" />
                </div>
            	<div id="media-head-2">                
                    <ul class="filter-by-cat">
                        <li><b>Hiển thị theo:</b></li>
                        <li><asp:LinkButton ID="lbtTatCa" runat="server" CssClass="gradient-btn selected" 
                                onclick="lbtTatCa_Click">Tất cả</asp:LinkButton></li>
                        <asp:Repeater ID="rptHienThiTheoViTri" runat="server" 
                            onitemcommand="rptHienThiTheoViTri_ItemCommand">
                            <ItemTemplate>
                                <li><asp:LinkButton ID="lbtViTriHienThi" runat="server" CommandArgument='<%# Eval("Id")%>' CommandName="hienthi"  CssClass="gradient-btn"><%# Eval("TenViTri") %></asp:LinkButton></li>
                            </ItemTemplate>
                        </asp:Repeater>                        
                    </ul>
               		<ul class="filter-by-date">
                    	<li><b>Sắp xếp theo ngày:</b></li>
                        <li><a href="#" title="Hiển thị banner tăng dần" class="gradient-btn selected tip">Tăng dần</a></li>
                        <li><a href="#" title="Hiển thị banner giảm dần" class="gradient-btn tip">Giảm dần</a></li>
                    </ul>                    
                </div>                               
            	<ul id="media-files-2">
                    <asp:Repeater ID="rptDanhSachBanner" runat="server" 
                        onitemcommand="rptDanhSachBanner_ItemCommand">
                        <ItemTemplate>
                            <li>
                                <%--<input type="checkbox" name="" />--%>                     	
                                <img src='<%# "../uploads/BannerQuangCao/" + Eval("HinhAnh")%>' alt="" width="120px" height="100px" />                       
                                <h2><%# Eval("Ten") %></h2>
                                <em>Ngày đăng: <%# Eval("NgayDang","{0:dd/MM/yyyy}") %></em>
                                <em>Loại: <%# Eval("TenViTri") %></em>
                                <div class="media-ctrls-2">                           
                                   <asp:HyperLink ID="hlSua" runat="server" class="edit-contact gradient-btn" NavigateUrl='<%# "~/admin/addbanner.aspx?location=no&action=edit&info=" + Eval("Id") %>'>Sửa</asp:HyperLink>
                                   <asp:LinkButton ID="lbXoaBanner" runat="server" onclientclick="return confirm('Không thể phục hồi sau khi xóa! Chắc chắn rằng bạn muốn xóa?');" class="gradient-btn" CommandArgument='<%# Eval("Id")%>' CommandName="delete" >Xóa</asp:LinkButton>
                                </div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>                                                                                                                                              
                </ul>
                <div class="box-bt-bar">            
                    <%--<ul class="box-nav">
                        <li><a href="#" title="" class="prev">Trước</a></li>
                        <li><a href="#" title="" class="active">1</a></li>
                        <li><a href="#" title="" class="num">2</a></li>

                        <li><a href="#" title="" class="num">3</a></li>
                        <li><a href="#" title="" class="num">4</a></li>
                        <li><a href="#" title="" class="num">..</a></li>
                        <li><a href="#" title="" class="next">Sau</a></li>
                    </ul>--%>
                    <div class="bulk-actions">
                       <%--<select name="field-13" class="select-1">
                            <option value="">Chọn thao tác</option>
                            <option value="">Sửa</option>
                            <option value="">Xóa</option>
                        </select>--%>
                        <asp:Button ID="btnLamMoiBanner" runat="server" Text="Làm mới" 
                            onclick="btnLamMoiBanner_Click" />                        
                    </div> 
                </div>                  
            </div>
        </div>                                                 
</div>

<script type="text/javascript" src="../templates/admin/scripts/checkAll.js"></script>
<script type="text/javascript">
    var rpt = document.getElementById('<%= rptDanhSachViTriBanner.ClientID %>');
    $('input:checkbox[id$=CheckSelectAll]', rpt).click(function(e)
    {
        if (this.checked)
        {
            $('input:checkbox[id$=CheckSelect]', rpt).attr('checked', true);
        }
        else
        {
            $('input:checkbox[id$=CheckSelect]', rpt).removeAttr('checked');
        }
    });
   
    $('input:checkbox[id$=CheckSelect]', rpt).click(function(e)
    {
        //Bo checkall
        if ($('input:checkbox[id$=CheckSelect]:checked', rpt).length == 0)
        {
            $('input:checkbox[id$=CheckSelectAll]', rpt).removeAttr('checked');
        }
        // Checkall
        else if ($('input:checkbox[id$=CheckSelect]:checked', rpt).length == $('input:checkbox[id$=CheckSelect]', rpt).length)
        {
            $('input:checkbox[id$=CheckSelectAll]', rpt).attr('checked', true);
        }
    });

</script>